<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>手机号</title>
</head>

<body>


    <script>
        //只要有abc其中的任何一个，就算你对了
        var patten = /[abc]/;
        var str = 'ertyeA';
        var r = patten.test(str);
        console.log('r:', r);

        var patten = /^1[3456789]\d{9}$/;
        var phone = '17839710826';
        var r1 = patten.test(phone);
        console.log('r1:', r1);

        //只要是符合范围内的一个就满足了，[A-z],匹配大写A到大写Z，小写a到小写z
        var patten = /[a-z]/;
        var str = 'abcA';
        var r2 = patten.test(str);
        console.log('r2:', r2);

        var pattern = /(red|blue|green|pink)/;
        var str = 'pink fdsaf';
        var r3 = pattern.test(str);
        console.log('r3:', r3);

        var pattern = /a+/;
        var str = 'aaaaaaaaaaaaaaaaaaaaa';
        var result = pattern.test(str);
        console.log('result:', result);
    </script>
</body>

</html>